<template>
	<view class="content">
		<navigator url="/pages/user/user" open-type="reLaunch">用户</navigator>
		<button @click="show">显示</button>
		<button @click="hide">隐藏</button>
		<button @click="stop">停止下拉刷新</button>
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area" v-for="item in 100" :key="item">
			{{item}}
		</view>
	</view>
</template>

<script setup>
	onShow(()=>{
		uni.setTabBarItem({
			index:1,
			text: '自定义'
		})
		uni.setTabBarBadge({
		  index: 1,
		  text: '21'
		})
		uni.showTabBarRedDot({
		  index: 2
		})
	})
	function show(){
		uni.showToast({
			title: '操作成功',
			image: '/static/images/xxmLogo.png',
			duration: 3000,
			success:res=>{
				console.log(res)
			}
		})

	}
	function hide(){
		uni.hideToast();
	}
	const count = ref(0)
	onReachBottom(()=>{
		console.log('触底了', count.value++)
	})
	setTimeout(()=>{
		uni.startPullDownRefresh();
		console.log('下拉刷新了')
	},1000)
	function stop(){
		uni.stopPullDownRefresh()
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
